<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>管理后台</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <!-- 新 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">

        <!-- 可选的Bootstrap主题文件（一般不用引入） -->
        <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

        <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
        <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

        <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
        <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>        
        <link href="Public/admin/css/dashboard.css" rel="stylesheet">
        <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css">

    </head>
    <body>
        <nav class="navbar navbar-inverse navbar-fixed-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#">管理后台</a>
                </div>
                <include file="./Public/admin/navbar.html" keywords="1" />

            </div>
        </nav>

        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-2 col-md-2">
                    <include file="./Public/admin/menu.html" keywords="1" />
                </div>
                <!--正式内容开始-->
                <div class="col-sm-9 col-md-10  main">
                    <h1 class="page-header">评论管理</h1>    
                    <form action="" method="Post">
                    <P><button class="btn btn-danger" type="submit">删除</button></p>     
                    <table id="table" ></table> 
                    </form>
                    

                </div>
                <!--正式内容结束-->
            </div>
        </div>



        <script src="http://cdn.bootcss.com/bootstrap-table/1.9.1/bootstrap-table.min.js"></script>
        <script src="http://cdn.bootcss.com/bootstrap-table/1.9.1/locale/bootstrap-table-zh-CN.min.js"></script>
        <script type="text/javascript">
            $('#table').bootstrapTable({
                url: './index.php?m=Center&c=admin&a=commentMessage',
                dataType: "json",

                silentSort: true,
                pagination: true,
                pageSize: 50,
                search: true,
                showExport: true,
                filterControl: true,
                pageList: [10, 25, 50, 100],
                showColumns: true, //是否显示所有的列
                showRefresh: true, //是否显示刷新按钮
                showToggle: true,
                clickToSelect: true, //是否启用点击选中行
                uniqueId: "ID", //每一行的唯一标识，一般为主键列
                minimumCountColumns: 2, //最少允许的列数
                showColumns: true, //列选择按钮
                uniqueId: "ID", //每一行的唯一标识，一般为主键列
                singleSelect: false,
                checkboxHeader: true,
                checkbox: true,
                radio: true,
                exportDataType: "basic",
                selectItemName: 'id[]',

                /*
                 *                 pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                 search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                 strictSearch: true,
                 showColumns: true,                  //是否显示所有的列
                 showRefresh: true,                  //是否显示刷新按钮
                 minimumCountColumns: 2,             //最少允许的列数
                 clickToSelect: true,                //是否启用点击选中行
                 height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
                 uniqueId: "ID",                     //每一行的唯一标识，一般为主键列
                 showToggle: true,                    //是否显示详细视图和列表视图的切换按钮
                 cardView: false,                    //是否显示详细视图
                 detailView: false,                   //是否显示父子表
                 */
                columns: [{
                     //   checkbox: true,
                        title: '<input onClick="selectALL()" type="checkbox">',
                        align: 'center',
                        valign: 'middle',
                        formatter: function (value, row, index) {
                            var id = '<input data-index="0" name="id[]" value="'+row.id +'" type="checkbox">';
                            return id;
                        }

                    }, {
                        field: 'log_time',
                        title: '时间',
                        align: 'center',
                        valign: 'middle'

                    },  {
                        field: 'a_content',
                        title: '文章内容',
                        align: 'center',
                        valign: 'middle',
                        width:'320',
                        height:'50'
                    },{
                        field: 'uid',
                        title: '用户ID',
                        align: 'center',
                        valign: 'middle',
                    },{
                        field: 'name',
                        title: '评论的用户',
                        align: 'center',
                        valign: 'middle',
                    }, {
                        field: 'content',
                        title: '内容',
                        align: 'center',
                        valign: 'middle',
                        formatter: function (value, row, index) {
                            if(row.type=='0'){
                                var content = row.content;
                            }else{
                                var content = "<audio src='"+row.audio+"' controls='controls' />" 
                            }
                            
                            return content;
                        }                        
                    }
                ]
            });


            function pullmsg() {

                var userID = $("#userid").val();
                var contetn = $('#content').val();
                $.ajax({
                    type: "POST",
                    url: "index.php?m=Center&c=admin&a=Message",
                    data: {
                        action: "addData",
                        userId: userID,
                        content: contetn
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data.status == "0") {
                            $('#table').bootstrapTable('refresh');
                        }
                        alert(data.data);
                    }
                });
            }

            function checkbox() {
                var checked = $("input[name='btSelectItem']:checked").val;
                alert(checked);
            }
            var i = 0;
            function selectALL(){
                if(i==0){
                    $("#table input").attr("checked","checked");
                    i=i+1;
                }else{
                    $("#table input").removeAttr("checked");
                    i=0;
                }
               
            }
        </script>
    </body>
</html>
